/**
 * fshows.com
 * Copyright (C) 2013-2019 All Rights Reserved.
 */
package com.example.fardemo.jmh.runner;

import org.phprpc.util.AssocArray;
import org.phprpc.util.Cast;
import org.phprpc.util.PHPSerializer;

import java.lang.reflect.InvocationTargetException;

/**
 *
 *
 * @author Liluqing
 * @version PHPSerilizeble.java, v 0.1 2019-03-28 9:17
 */
public class PHPSerilizeble {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        String t = "a:2:{i:0;a:15:{s:8:\"username\";s:8:\"lijie003\";s:3:\"uid\";i:1512211;s:9:\"role_type\";i:0;s:8:\"store_id\";s:0:\"\";s:5:\"token\";s:6:\"203481\";s:12:\"access_token\";s:32:\"207103d4326660cda34ceb327e4f0dd3\";s:13:\"sub_config_id\";i:0;s:10:\"is_collect\";i:1;s:10:\"index_type\";i:0;s:6:\"isPush\";i:1;s:10:\"pre_access\";i:0;s:9:\"pre_order\";i:0;s:10:\"store_name\";s:0:\"\";s:20:\"is_new_member_system\";i:1;s:7:\"is_sign\";i:0;}i:1;N;}";
        PHPSerializer p = new PHPSerializer();
        AssocArray array = (AssocArray) p.unserialize(t.getBytes());
        AssocArray object = (AssocArray) array.get(0);
        User u = (User) Cast.cast(object, User.class);
        System.out.println(u);
    }
}